<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>访问节点的操作</title>
    <style>
        p{
            color: black;
        }
    </style>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div id="div1">div1</div>
    <p>外面的p标签</p>
</body>
<script>

    var divs=document.getElementsByClassName("div");
    console.log(divs);
    
    for (let index = 0; index < array.length; index++) {
     console.log(divs[index]);
      
    }
    // getElementsById 可以通过id获取到具体某个页面

    var div1 =document.querySelector("#div1")
    console.log(div1);
    div1.innerHTML="我是div1"
    

</script>
</html>